/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package socof.wget;

import java.util.HashSet;
import java.util.Set;

/**
 *
 * @author Carlos Pinheiro
 */
public class DownloadedSet
{    
    private static Set<String> hs = new HashSet<String>();    
    private static DownloadedSet instance = new DownloadedSet();   
    
    public static DownloadedSet getInstance()
    {
        return instance;
    }
    
    public synchronized boolean add (String absUrl)
    {
        return hs.add(absUrl);
    }
    
    public synchronized boolean alreadyDownloaded (String absUrl)
    {
        return hs.contains(absUrl);
    }
    
    public synchronized String[] getStringArray()
    {
        return hs.toArray(new String[hs.size()]);
    }
}
